const { ccclass, property, menu } = cc._decorator;

@ccclass
@menu('game/ResultTipComponent')
export default class ResultTipComponent extends cc.Component {

    @property(cc.Label)
    rightLbl: cc.Label = null;

    @property(cc.Label)
    wrongLbl: cc.Label = null;

    tip(right: boolean, text: string) {
        this.node.active = true;
        this.node.setPosition(0, 0);
        this.node.opacity = 255;

        this.rightLbl.node.active = !!right;
        this.wrongLbl.node.active = !right;

        if (right) {
            this.rightLbl.string = text;
        } else {
            this.wrongLbl.string = text;
        }

        this.getComponent(cc.Animation).play('result-tip');
    }
}
